package job4;
/*
模拟一个银行存款的程序。假设有两个储户都去银行往同一个账户进行存款，一次存100，每人存三次。要求储户
每存一次钱，账户余额增加100，并在控制台输出当前账户的余额。
 */



public class Deposit implements Runnable {
    private int money = 0;

    @Override
    public void run() {
        String name = Thread.currentThread().getName();
        for (int i = 1; i <= 3; i++) {
            money += 100;
            System.out.println(name + "第" + i + "次存款" + money + "元");

        }
    }

    public static void main(String[] args) {
        Runnable t = new Deposit();
        Thread t1 = new Thread(t, "王一");
        Thread t2 = new Thread(t, "赵二");

        t1.start();
        t2.start();

    }
}
